<template>
  <view class="flex-table">
    <view class="flex-tr">
      <view class="flex-td--label">作业申请单位</view>
      <view class="flex-td--value flex-center">{{ ticket.applyUnitName }}</view>
      <view class="flex-td--label">作业申请时间</view>
      <view class="flex-td--value flex-center">{{
        $u.timeFormat(ticket.createTime, 'yyyy 年 mm 月 dd 日 hh 时 MM 分')
      }}</view>
    </view>
    <view class="flex-tr">
      <view class="flex-td--label">作业内容</view>
      <view class="flex-td--value flex-center">{{ ticket.workContent }}</view>
      <view class="flex-td--label">动火地点及动火部位</view>
      <view class="flex-td--value flex-center">{{ detail.workLocation }}</view>
    </view>
    <view class="flex-tr">
      <view class="flex-td--label">动火作业级别</view>
      <view class="flex-td--value flex-center">{{ ticket.ticketWorkLevelLabel }}</view>
      <view class="flex-td--label">动火方式</view>
      <view class="flex-td--value flex-center">{{ workPatternLabel }}</view>
    </view>
    <view class="flex-tr">
      <view class="flex-td--label">动火人及证书编号</view>
      <view class="flex-td--value flex-center">
        <view v-for="item in detail.workCertificates" :key="item.userId" class="text-center">
          {{ item.name }}{{ item.qualityNumber }}
        </view>
      </view>
    </view>
    <view class="flex-tr">
      <view class="flex-td--label">作业单位</view>
      <view class="flex-td--value flex-center">{{ ticket.unitName }}</view>
      <view class="flex-td--label">作业负责人</view>
      <view class="flex-td--value" style="display: block">
        <image
          v-for="imgItem in operationManagerSignatures"
          :key="imgItem"
          :src="`${staticUrl}${imgItem}`"
          mode="aspectFill"
          class="signature__img"
          @click="handlePreviewImage(`${staticUrl}${imgItem}`, operationManagerSignatures)"
        ></image>
      </view>
    </view>
    <fire-analyse-table :ticket-id="ticketId" />
    <view class="flex-tr">
      <view class="flex-td--label">关联的其他特殊作业及安全作业票编号</view>
      <view class="flex-td--value flex-center">{{ relevanceTicketLabel }}</view>
    </view>
    <view class="flex-tr">
      <view class="flex-td--label">风险辨识结果</view>
      <view class="flex-td--value flex-center">{{ ticket.riskIdentificationResultLabel }}</view>
    </view>
    <view class="flex-tr">
      <view class="flex-td--label">作业实施时间</view>
      <view class="flex-td--value flex-center">{{ actualDateLabel }}</view>
    </view>
  </view>
</template>
<script>
import ticketTableMixin from './ticketTableMixin'
import FireAnalyseTable from './FireAnalyseTable.vue'
export default {
  components: { FireAnalyseTable },
  mixins: [ticketTableMixin],
  props: {
    ticketId: [Number, String],
    detail: {
      type: Object,
      default: () => ({})
    },
    inspect: {
      type: Object,
      default: () => ({})
    },
    signatures: {
      type: Array,
      default: () => []
    },
    ticket: {
      type: Object,
      default: () => ({})
    },
    relevanceTicketLabel: String,
    riskIdentificationResult: String,
    actualDateLabel: String
  },
  computed: {
    workPatternLabel() {
      if (!this.detail.workPattern) {
        return ''
      }
      const workPattern = []
      this.detail.workPattern.forEach((item) => {
        workPattern.push(item.label)
      })
      if (this.detail.otherWorkPattern) {
        workPattern.push(this.detail.otherWorkPattern)
      }
      return workPattern.join('，')
    }
  }
}
</script>
<style scoped lang="scss">
@import './style.scss';
</style>
